<!doctype html>
<html>
<head> 
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
	<title>订单详情</title>
	<link rel="stylesheet" type="text/css" href="{:C('WEB_URL')}Public/css/base.css">
	<link rel="stylesheet" type="text/css" href="{:C('WEB_URL')}Public/mobile/css/master.css">
</head>
<body>
	<header class="tcenter fs14">
        <a href="tel:4006730088" class="tel iconfont">&#xe610;</a>
        <a href="{:C('WEB_URL')}mobile/" class="iconfont fright">&#xe60f;</a>
        <a href="javascript:window.history.go(-1)" class="iconfont fleft">&#xe612;</a>
        订单详情
    </header>

	<div class="wrap" id="order">
		<div class="orderMain">
			<p class="code"><em>{$orderStatus[$order['status']]}</em>订单号：{$order['order_num']}</p>
			<div class="auto">
				<img src="http://app2.haixiuyizhan.com/{$order['brand_logo']}" />
				<p class="name">{$order['brand_name']} {$order['model_name']} {$order['model_pl']} {$order['model_year']}</p>
			</div>
		</div>
		<div class="orderInfo">
			<dl>
				<notempty name="order['headImage']">
					<dt>安装维修厂</dt>
					<dd class="orderCompany">
						<img src="http://app2.haixiuyizhan.com/{$order['headImage']}" />
						<p class="name">{$order['wx_name']}</p>
						<p class="address">{$order['wx_address']}</p>
					</dd>
				</notempty>

				<dt>保养配件</dt>
				<dd class="part">
					<ul>
						<volist name="partList" id="vo">
							<li>
								<img src="http://app2.haixiuyizhan.com/{$vo['logo']}" />
								<p class="name">{$vo['pj_name']}</p>
								<p class="count">数量：{$vo['count']}</p>
								<p class="price"><em>￥{$vo['pj_csprice']}</em> <span>￥{$vo['pj_scprice']}</span></p>
							</li>
							<php>$price+=$vo['pj_csprice'];$priceM+=$vo['pj_scprice'];</php>
						</volist>
					</ul>
					<p class="total">总价：<em>￥{$order['all_price']}</em></p>
				</dd>
				
				<volist name="log" id="vo">
					<notempty name="vo['time']">
					<dt>{$vo['title']}</dt>
					<dd class="log">
						<i>&#xe613;</i>{$vo['time']|date='Y-m-d H:i',###}
					</dd>
					</notempty>
				</volist>

				<notempty name="comment">
					<dt>评论时间</dt>
					<dd class="log">
						<i>&#xe613;</i>{$comment['create_time']|date='Y-m-d H:i',###}
						<notempty name="comment['commentTxt']">
							<p class="fs12 fc-999">评价内容：{$comment['commentTxt']}</p>
						</notempty>
					</dd>
				</notempty>

			</dl>
	
			<elt name="order.pay_type" value="0">
				<div class="pay">
			        <div class="index">
			        	<p class="price"><span class="mPrice">￥{$priceM}</span>
			        	<em>￥{$price}</em></p>
			        </div>
			        <a href="<?php if($Server=='wx'){echo 'javascript:callpay();';}else{echo '/mobile/alipaywap?order_id='.$order['order_id'];} ?>" id="J_btnGoStep1" >立即支付</a>
			    </div>
			</elt>
			<eq name="order.status" value="20">
				<span class="btnGray">待发货</span>
			</eq>
			<eq name="order.status" value="30">
				<a href="javascript:void(0)" class="btnBlue" onclick="receive.alert()">确认收货</a>
			</eq>
			<neq name="order.status" value="100">
			<a href="{:U('comment')}?order_id={$order['order_id']}" class="btnBlue <lt name="order.status" value="40">hide</lt>" id="J_btnComment"  >确认评价</a>
			</neq>
		</div>
	</div>
	<div id="alert">
		<div class="alertMain">
			<p class="txt">请确认您已收到我们的商品！</p>
			<a href="javascript:void(0)" class="gray" onclick="$('#alert').hide()">取消</a>
			<a href="javascript:void(0)" class="blue" onclick="receive.receive('{$order.order_id}',this)">确定</a>
			<p class="tip"></p>
		</div>
	</div>

	<include file="Public/mobileHome" />

	<script type="text/javascript">
		var receive={
			alert:function(){
				$("#alert").show();
			},
			receive:function(order_id,t){
				$("#alert").find("tip").html("努力加载中...");
				$.ajax({
	                 url:"{:C('WEB_URL')}mobile/receive.html",
	                 type:"POST",
	                 data:{"order_id":order_id},
	                 datType:"JSON",
	                 success:function(res){
						if(res.status==1){
							//收货成功
							$("#alert").hide().find("tip").html("");
							$("#J_btnComment").addClass("show").prev("a").addClass("hide");

						}
	                    showMsgTip(res.info,2000);
	                    return false;
	                 }
	             })
			}
		}
        
		  //调用微信JS api 支付
		function jsApiCall()
		{
	        $("#loading").hide();
			WeixinJSBridge.invoke(
				'getBrandWCPayRequest',
				{$jsApiParameters},
				function(res){
					WeixinJSBridge.log(res.err_msg);
					//alert(res.err_code+res.err_desc+res.err_msg);
					if(res.err_msg=="get_brand_wcpay_request:ok"){
						window.location.href="{:U('step4')}";
					}
				}
			);
		}

		function callpay()
		{	
			if (typeof WeixinJSBridge == "undefined"){
			    if( document.addEventListener ){
			        document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
			    }else if (document.attachEvent){
			        document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
			        document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
			    }
			}else{
			    jsApiCall();
			}
		}	
	</script>
</body>
</html>